<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>022在Vue中使用animate.css库</title>
  <script src="./vue.js"></script>
  <link rel="stylesheet" href="./animate.css">
  <style>
    @keyframes bounce-in {
      0% {
        transform: scale(0);
      }
      50% {
        transform: scale(1.5);
      }
      100% {
        transform: scale(1);
      }
    }
    /* 命名 默认 */
    .fade-enter-active {
      transform-origin: left center;
      animation: bounce-in 1s;
    }
    .fade-leave-active {
      transform-origin: left center;
      animation: bounce-in 1s reverse;
    }

    /* 命名 不默认 */
    .active {
      transform-origin: left center;
      animation: bounce-in 1s;
    }
    .leave {
      transform-origin: left center;
      animation: bounce-in 1s reverse;
    }
  </style>
</head>
<body>
  <div id="root">
    <!-- <transition name="fade" enter-active-class="active" leave-active-class="leave"> -->
    <transition name="fade">
      <div v-show="show">hello world</div>
    </transition>
    <button @click="handleBtnClick">切换</button>

    <!-- 命名自定义 -->
    <transition 
                name="fade"
                enter-active-class="active"
                leave-active-class="leave">
      <div v-show="show">hello world</div>
    </transition>
    <button @click="handleBtnClick">切换</button>

    <!-- 引入animate.min.css -->
    <transition 
                name="fade"
                enter-active-class="animated swing"
                leave-active-class="animated swing">
     <div v-show="show">hello world</div>
     </transition>

    <button @click="handleBtnClick">切换</button>
  </div>
  <script>
    var vm = new Vue({
      el: "#root",
      data: {
        show: true
      },
      methods: {
        handleBtnClick: function () {
          this.show = !this.show;
        }
      },
    })
  </script>
  
</body>
</html>